<?php
/**
 * Core_Personal_LoginForm
 * 
 * @author naspeh
 * @version $Id: LoginForm.php 659 2008-06-15 11:34:26Z naspeh $
 */
class Core_Personal_LoginForm extends Core_Form 
{
    /**
     * Инициализация
     *
     * @return Core_Personal_LoginForm
     */
    public function init()
    {
        $this->addElement('text', 'name', array(
            'required' => true,
            'label'    => 'логин:',
            'attribs'  => array(
                'class' => 'text span-4',
                'size'  => 16
            ),     
            'validators' => array(
                new Zend_Validate_Alnum(),
                new Zend_Validate_StringLength(null,16),
            )
        ));
        $this->addElement('password', 'password', array(
            'required' => true,
            'label'    => 'пароль:',
            'attribs'  => array(
                'class' => 'text span-4',
            ),
        ));
        $this->addElement('button', 'submit', array(
            'type'     => 'submit',
            'label'    => 'Войти',
            'attribs'  => array(
                'class' => 'positive',
                'icon'  => 'tick'
            )
        ));
        return $this;
    }
    /**
     * Вторичная валидация
     *
     * @return Core_Personal_LoginForm
     */
    protected function _setPostValid()
    {
        $this->getElement(self::FIRST_ELEMENT)->addValidator(new Core_Validate_CheckAuth());
        return $this;
    }
}
